<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // 字面量方式
        var yq = {
            name : '于谦',
            age: 38,
            sayHi: function () {
                console.log('您好');
            }
        }
        var yq = {
            name: '于谦',
            age: 38,
            sayHi: function () {
                console.log("你好");
            }
        }
        var yq = {
            name: '于谦',
            age: 38,
            sayHi: function () {
                console.log('您好');
            }
        }
        // 系统构造函数方式
        var sy = new Object();
        sy.name = '名字';
        sy.age = '年龄';
        sy.sayHi = function () {
            console.log('您好');
        }
        var sy = new Object();
        sy.name = '名字';
        sy.age = '年龄';
        sy.sayHi = function () {
            console.log('您好');
        }
        var sy = new Object();
        sy.name = '名字';
        sy.age = '年龄';
        sy.sayHi = function () {
            console.log('您好');
        }
        // 自定义构造函数
        function Person(name,age) {
            this.name = name;
            this.age = age;
            this.sayHi = function () {
                console.log('您好');
            }
        }
        var zhangsan = new Person('张三',18);
        function Person(name,age) {
            this.name = name;
            this.age = age;
            this.sayHi = function () {
                console.log('您好');
            }
        }
        var zhangsan = new Person('张三',18);
        function Person(name,age) {
            this.name = name;
            this.age = age;
            this.sayHi = function () {
                console.log('您好');
            }
        }
        var zhangsan = new Person('张三',18);
    </script>
</body>
</html>